import React from "react";
class Hello extends React.Component {
  state = {
    count: 0,
  };
  handleClick() {
    alert("类组件事件绑定！");
  }

  add() {
    this.setState({
      count: this.state.count + 1,
    });
  }

  render() {
    return (
      <div>
        <h1>计数器：{this.state.count}</h1>
        <button onClick={this.add.bind(this)}>点击+1</button>
      </div>
    );
  }
}

export default Hello;
